package com.education.realtime.fuction;

import com.education.realtime.util.IkUtil;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

import java.io.IOException;
import java.util.List;


@FunctionHint(output = @DataTypeHint("row<word string>"))
public class IKAnalyzer extends TableFunction<Row> {
    public void eval(String kw) throws IOException {
        //
       List<String> list =  IkUtil.split(kw);
        for (String word : list) {
            collect(Row.of(word));
        }
    }
}
